import { ADD, MINUS, SETNAME } from './actionType'
// 它最终的目的，就是生成action对象
export const add = (payload) => {
    return {
        type: ADD,
        payload
    }
}
export const minus = (payload) => {
    return {
        type: MINUS,
        payload
    }
}
export const asyncMinus = payload => {
    return dispatch => {
        setTimeout(() => {
            dispatch(minus(payload))
        }, 2000)
    }
}
export const setName = payload => {
    return {
        type: SETNAME,
        payload
    }
}
export const asyncSetName = payload => {
    return dispatch => {
        setTimeout(() => {
            dispatch(setName(payload))
        }, 2000)
    }
}
